/**
 * major.jsp页面
 */
 function getHeadTd(name) {
  return '<td class="head"><span>' + name + '</span></td>';
 }

 function getHead(headArray) {
  var tr = "<tr>";
  $.each(headArray, function (index, item) {
   tr += getHeadTd(item);
  });
  tr += "</tr>";
  return tr;
 }

 function getValueTd(value) {
  return '<td>' + value + '</td>';
 }

 function getValueTr(valueArray) {
  var tr = "<tr>";
  $.each(valueArray, function (index, item) {
   // debugs("item[index]:"+item);
   // debugs(index+"item[index]:"+item[index]);
   tr += getValueTd(item);
  });
  tr += "</tr>";
  return tr;
 }

 function filtUndef(value) {
  if (typeof(value) == "undefined") {
   return "";
  }
  return value;
 }

 function getYmdTime(value) {
  return getTimeYMDStr(value);
 }

 function mod(id) {
  window.location.href = "api/majors/edit/" + id
 }

 function thaw(id, status) {
  if (0 != status) {
   alertOk("<fmt:message key='no.sealed'/>！");
   return false;
  }
  if (window.confirm('<fmt:message key="sure.remove.sealed"/>？')) {
   window.location.href = "admin/member/seal?ids=" + id + "&thaw=" + 1;
  } else {
   return false;
  }

 }
 function rowResetUser(ids) {
  window.location = 'admin/member/view?ids=' + ids;
 }

 function del(id) {
  var setIds = [];
  setIds.push(id);
// layer.confirm('确定要删除该条'+baseBusName+'数据？', {
  layer.confirm('<fmt:message key="sys.deleteSelectData"/>', {
   btn: ['<fmt:message key="sys.yes"/>', '<fmt:message key="sys.exit"/>']
   , btn2: function (index, layero) {
    layer.close(index);
   }, title: ['<fmt:message key="Delete.the.prompt"/>', true]
  }, function (index, layero) {
   rowDelete(setIds);
   // location.href="admin/member/remove/"+setIds;
  });
 }

 function rowDelete(id) {
  debugs(id);
  $.ajax({
   url: "admin/member/remove",// ?rand =+Math.random(),
   type: 'POST',
   contentType: "application/json",
   dataType: 'json',
   data: JSON.stringify({"ids": id}),
   success: function (data) {
    debugs(data);
    if (data != null && data.flag) {
     alertOk('<fmt:message key="sys.deleteSuccess"/>');
     $('#listForm').submit();
    } else {
     alertError('<fmt:message key="sys.deleteFailed"/>');
    }
   }
  });
 }

  function convertLevel(params) {
    var level = params;
    var result = "";
    if (level == 1) {
      result = "本科";
    } else if (level == 2) {
      result = "专科";
    } else {
      result = "--";
    }
    return result;
  }

  function convertDirection(params) {
    var level = params;
    var result = "";
    if (level == 1) {
      result = "文科";
    } else if (level == 2) {
      result = "理科";
    } else {
      result = "--";
    }
    return result;
  }
